Replace Assert.IsTrue with CollectionAssert.AreEqual for collection comparisons#1730
Merged
Merged
Conversation
Replace Assert.IsTrue(xxx.IsEqualTo(yyy)) and Assert.IsTrue(xxx.SequenceEqual(yyy)) with CollectionAssert.AreEqual(expected, actual) across 55 test files Co-authored-by: Rob-Hague <5132141+Rob-Hague@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Refactor collection assertions to use CollectionAssert.AreEqual
Replace Assert.IsTrue with CollectionAssert.AreEqual for collection comparisons
Nov 4, 2025
Copilot stopped work on behalf of
Rob-Hague due to an error
November 4, 2025 07:54
Rob-Hague
reviewed
Nov 13, 2025
…y using directives - Fixed argument order in KeyExchangeDhGroupExchangeReplyTest.cs (expected first, actual second) - Fixed argument order in KeyExchangeInitMessageTest.cs (expected first, actual second) - Removed unnecessary 'using System.Linq' directives from all affected test files Co-authored-by: Rob-Hague <5132141+Rob-Hague@users.noreply.github.com>
Contributor
Author
Fixed in commit 2821526. All IDE0005 warnings have been resolved by removing unnecessary using directives, and the argument order issues in the review comments have been corrected. The build now succeeds with 0 warnings and 0 errors. |
Rob-Hague
approved these changes
Nov 13, 2025
Collaborator
|
@copilot resolve conflicts |
Contributor
Author
…-collection-assertions # Conflicts: # test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteLessBytesThanBufferCanContain.cs # test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteMoreBytesThanBufferCanContain.cs
8e5e1bd to
b8a5836
Compare
…-collection-assertions # Conflicts: # test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpDataResponseTest.cs
Member
|
Isn't CollectionAssert sort of deprecated? |
Collaborator
|
I don't know, but it prints nice error messages This was mostly just a copilot test |
WojciechNagorski
approved these changes
Jun 26, 2026
Collaborator
|
Good enough. These days, you can change the entire framework in a single day, so if it provides benefits, it's fine. |
…ollection-assertions
Copilot
AI
changed the title
Replace Assert.IsTrue with CollectionAssert.AreEqual for collection comparisons
Merge develop into refactor-collection-assertions; scan for new CollectionAssert opportunities
Jun 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Brings the
copilot/refactor-collection-assertionsbranch up to date withorigin/develop(21 new commits) and checks whether any newly introduced test code warrants additionalCollectionAssertconversions.Changes
origin/develop— incorporates upstream changes including in-place encryption, serialisation buffer work, cipher/AES refactors, and various dependency bumpsAbstractionsTest.cshad ausingdirective ordering conflict; resolved by keeping our version (body already contained all necessary directives, so the develop version's top-of-file additions would have been duplicates)Assert.AreEqualcalls in the merged code compare scalar values (lengths, names, enums), so no new conversions are neededOriginal prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.